package view.component.render
{
import framework.view.components.button.StateButtonProxy;
import framework.view.components.container.RepeaterRenderProxy;

import view.component.window.event.NavigationChangeEvent;

/**
 * NavItemRenderProxy
 * @author jliang
 *
 */
public class NavItemRenderProxy extends RepeaterRenderProxy
{
    //==========================================================================
    //  Constructor
    //==========================================================================
    public function NavItemRenderProxy()
    {
        super();
    }
    //==========================================================================
    //  Variables
    //==========================================================================
    protected function get btn():StateButtonProxy
    {
        return proxys["btn"];
    }
    //==========================================================================
    //  Overridden methods: ShopNavRenderProxy
    //==========================================================================
    override protected function get proxyMapping():Array
    {
        return [ 
            { skin:"", classRef: StateButtonProxy, id:"btn", onSelected: selectedHandler }
        ];
    }
    
    override public function set selected(value:Boolean):void
    {
        btn.selected = value;
    }
    
    override public function get selected():Boolean
    {
        return btn.selected;
    }
    
    protected function selectedHandler():void
    {
        var evt:NavigationChangeEvent = new NavigationChangeEvent(NavigationChangeEvent.NAV_CHANGED, true);
        evt.param = data;
        skin.dispatchEvent(evt);
    }
}
}




